/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * WorkingPatternEditor.java
 *
 * Created on 05-Jun-2009, 12:21:29
 */
package TimeRecording.forms;

import TimeRecording.business.DaisyChainSystem;
import TimeRecording.tables.Employee;
import TimeRecording.tables.WorkingPattern;
import TimeRecording.widgets.FloatConverter;
import TimeRecording.widgets.FloatTextField;
import java.awt.CardLayout;
import javax.swing.JDialog;
import org.jdesktop.application.Action;

/**
 *
 * @author cbegg
 */
public class WorkingPatternEditor extends javax.swing.JDialog {

    private final static String CLOCKED_PANEL = "Clocked Panel";
    private final static String DAILY_PANEL = "Fixed Daily Panel";
    private final static String WEEKLY_FLEXI_PANEL = "Weekly Flexi Panel";
    private final static String FULL_FLEXI_PANEL = "Full Flexi Panel";
    private final static String SESSIONAL_PANEL = "Sessional Panel";
    private final static String AD_HOC_PANEL = "Ad Hoc Panel";

    private FloatConverter floatConverter = new FloatConverter();

    // TODO: This getter setter is a horrible frig several hours have been
    // wasted binding to the noOfHours property of the working pattern.
    
    public float patternHours;

    public float getPatternHours() {
        return patternHours;
    }

    public void setPatternHours(float patternHours) {
        float oldPatternHours = this.patternHours;
        this.patternHours = patternHours;
        firePropertyChange("oldPatternHours", oldPatternHours, patternHours);
        workingPattern.setNoOfHours(patternHours);
    }

    // <editor-fold defaultstate="collapsed" desc="'saved' property + getter & setter">
    protected boolean saved = false;

    public boolean getSaved() {
        return saved;
    }

    public void setSaved(boolean saved) {
        boolean oldSaved = this.saved;
        this.saved = saved;
        firePropertyChange("saved", oldSaved, saved);
    } // </editor-fold>

    // <editor-fold defaultstate="collapsed" desc="'employee' property + getter & setter">
    protected Employee employee;

    public Employee getEmployee() {
        return employee;
    }

    public void setEmployee(Employee employee) {
        Employee oldEmployee = this.employee;
        this.employee = employee;
        firePropertyChange("employee", oldEmployee, employee);
    } // </editor-fold>

    // <editor-fold defaultstate="collapsed" desc="'workingPattern' property + getter & setter (does not support property change)">
    protected WorkingPattern workingPattern;

    public WorkingPattern getWorkingPattern() {
        return workingPattern;
    }

    public void setWorkingPattern(WorkingPattern workingPattern) {
        WorkingPattern oldWorkingPattern = this.workingPattern;
        this.workingPattern = workingPattern;
        firePropertyChange("workingPattern", oldWorkingPattern, workingPattern);
        setPatternHours(workingPattern.getNoOfHours());
    } // </editor-fold>

    // <editor-fold defaultstate="collapsed" desc="Constructors">
    public WorkingPatternEditor() {
        super();
    }
    
    @SuppressWarnings("OverridableMethodCallInConstructor")
    public WorkingPatternEditor(JDialog parent,
            WorkingPattern workingPattern, Employee employee) {

        super(parent, true);
        setWorkingPattern(workingPattern);
        setEmployee(employee);
        initComponents();
        
    } // </editor-fold>
    
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {
        java.awt.GridBagConstraints gridBagConstraints;
        bindingGroup = new org.jdesktop.beansbinding.BindingGroup();

        periodTypeListCellRenderer = new TimeRecording.forms.renderers.PeriodTypeListCellRenderer();
        periodTypeConverter = new TimeRecording.enums.PatternTypeConverter();
        employeePanel = new javax.swing.JPanel();
        employeeLabel = new javax.swing.JLabel();
        employeeText = new javax.swing.JTextField();
        periodNumberLabel = new javax.swing.JLabel();
        periodNumberText = new javax.swing.JTextField();
        periodTypeLabel = new javax.swing.JLabel();
        periodTypeCombo = new TimeRecording.widgets.PeriodTypeComboBox();
        startDateLabel = new javax.swing.JLabel();
        patternStartDate = new com.toedter.calendar.JDateChooser();
        endDateLabel = new javax.swing.JLabel();
        periodEndDate = new com.toedter.calendar.JDateChooser();
        patternPanel = new javax.swing.JPanel();
        clockedPanel = new javax.swing.JPanel();
        startTimeLabel = new javax.swing.JLabel();
        clockedPatternStartTime = new javax.swing.JFormattedTextField();
        endTimeLabel = new javax.swing.JLabel();
        clockedPatternEndTime = new javax.swing.JFormattedTextField();
        clockedDaysPanel = new javax.swing.JPanel();
        clockedMondayCheckBox = new javax.swing.JCheckBox();
        clockedTuesdayCheckBox = new javax.swing.JCheckBox();
        clockedWednesdayCheckBox = new javax.swing.JCheckBox();
        clockedThursdayCheckBox = new javax.swing.JCheckBox();
        clockedFridayCheckBox = new javax.swing.JCheckBox();
        clockedSaturdayCheckBox = new javax.swing.JCheckBox();
        clockedSundayCheckBox = new javax.swing.JCheckBox();
        clockedWeeklyHoursLabel = new javax.swing.JLabel();
        dailyHoursLabel = new javax.swing.JLabel();
        clockedDailyHours = new javax.swing.JFormattedTextField();
        clockedWeeklyHours = new javax.swing.JFormattedTextField();
        weeklyFlexiPanel = new javax.swing.JPanel();
        weeklyFlexiWeeklyLabel = new javax.swing.JLabel();
        weeklyFlexiWeeklyHours = new FloatTextField();
        weeklyFlexiDaysPanel = new javax.swing.JPanel();
        weeklyFlexiMondayCheckBox = new javax.swing.JCheckBox();
        weeklyFlexiTuesdayCheckBox = new javax.swing.JCheckBox();
        weeklyFlexiWednesdayCheckBox = new javax.swing.JCheckBox();
        weeklyFlexiThursdayCheckBox = new javax.swing.JCheckBox();
        weeklyFlexiFridayCheckBox = new javax.swing.JCheckBox();
        weeklyFlexiSaturdayCheckBox = new javax.swing.JCheckBox();
        weeklyFlexiSundayCheckBox = new javax.swing.JCheckBox();
        weeklyFlexiDailyHoursLabel = new javax.swing.JLabel();
        weeklyFlexiDailyHours = new javax.swing.JFormattedTextField();
        fixedDailyPanel = new javax.swing.JPanel();
        fixedDailyHoursLabel = new javax.swing.JLabel();
        fixedDailyDailyHours = new FloatTextField();
        fixedDailyDaysPanel = new javax.swing.JPanel();
        fixedDailyMondayCheckBox = new javax.swing.JCheckBox();
        fixedDailyTuesdayCheckBox = new javax.swing.JCheckBox();
        fixedDailyWednesdayCheckBox = new javax.swing.JCheckBox();
        fixedDailyThursdayCheckBox = new javax.swing.JCheckBox();
        fixedDailyFridayCheckBox = new javax.swing.JCheckBox();
        fixedDailySaturdayCheckBox = new javax.swing.JCheckBox();
        fixedDailySundayCheckBox = new javax.swing.JCheckBox();
        fixedDailyWeeklyHoursLabel = new javax.swing.JLabel();
        fixedDailyWeeklyHours = new javax.swing.JFormattedTextField();
        fullFlexiPanel = new javax.swing.JPanel();
        fullFlexiDailyHoursLabel = new javax.swing.JLabel();
        fullFlexiDailyHours = new FloatTextField();
        fullFlexiWeeklyLabel = new javax.swing.JLabel();
        fullFlexiWeeklyHours = new javax.swing.JFormattedTextField();
        sessionalPanel = new javax.swing.JPanel();
        sessionalHoursLabel = new javax.swing.JLabel();
        sessionalDailyHours = new FloatTextField();
        sessionalDaysPanel = new javax.swing.JPanel();
        sessionalMondayCheckBox = new javax.swing.JCheckBox();
        sessionalTuesdayCheckBox = new javax.swing.JCheckBox();
        sessionalWednesdayCheckBox = new javax.swing.JCheckBox();
        sessionalThursdayCheckBox = new javax.swing.JCheckBox();
        sessionalFridayCheckBox = new javax.swing.JCheckBox();
        sessionalSaturdayCheckBox = new javax.swing.JCheckBox();
        sessionalSundayCheckBox = new javax.swing.JCheckBox();
        sessionalWeeklyHoursLabel = new javax.swing.JLabel();
        sessionalWeeklyHours = new javax.swing.JFormattedTextField();
        adHociPanel = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        buttonPanel = new javax.swing.JPanel();
        saveButton = new javax.swing.JButton();
        cancelButton = new javax.swing.JButton();
        enablePeriodStart = new javax.swing.JCheckBox();
        enablePeriodEnd = new javax.swing.JCheckBox();

        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(TimeRecording.TimeRecordingApp.class).getContext().getResourceMap(WorkingPatternEditor.class);
        periodTypeListCellRenderer.setText(resourceMap.getString("periodTypeListCellRenderer.text")); // NOI18N
        periodTypeListCellRenderer.setName("periodTypeListCellRenderer"); // NOI18N

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle(resourceMap.getString("Form.title")); // NOI18N
        setName("Form"); // NOI18N
        getContentPane().setLayout(new java.awt.GridBagLayout());

        employeePanel.setBorder(javax.swing.BorderFactory.createEmptyBorder(8, 1, 1, 1));
        employeePanel.setName("employeePanel"); // NOI18N

        employeeLabel.setText(resourceMap.getString("employeeLabel.text")); // NOI18N
        employeeLabel.setName("employeeLabel"); // NOI18N
        employeePanel.add(employeeLabel);

        employeeText.setEditable(false);
        employeeText.setMinimumSize(new java.awt.Dimension(150, 20));
        employeeText.setName("employeeText"); // NOI18N
        employeeText.setPreferredSize(new java.awt.Dimension(250, 20));

        org.jdesktop.beansbinding.Binding binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_ONCE, this, org.jdesktop.beansbinding.ELProperty.create("${employee.friendlyName}"), employeeText, org.jdesktop.beansbinding.BeanProperty.create("text"));
        bindingGroup.addBinding(binding);

        employeePanel.add(employeeText);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.gridwidth = 6;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        getContentPane().add(employeePanel, gridBagConstraints);

        periodNumberLabel.setText(resourceMap.getString("periodNumberLabel.text")); // NOI18N
        periodNumberLabel.setName("periodNumberLabel"); // NOI18N
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
        gridBagConstraints.weighty = 0.25;
        gridBagConstraints.insets = new java.awt.Insets(5, 8, 5, 4);
        getContentPane().add(periodNumberLabel, gridBagConstraints);

        periodNumberText.setEditable(false);
        periodNumberText.setEnabled(false);
        periodNumberText.setName("periodNumberText"); // NOI18N

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${workingPattern.workingPatternPK.patternIndex}"), periodNumberText, org.jdesktop.beansbinding.BeanProperty.create("text"));
        bindingGroup.addBinding(binding);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.gridwidth = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.weightx = 0.5;
        gridBagConstraints.weighty = 0.25;
        gridBagConstraints.insets = new java.awt.Insets(5, 4, 5, 4);
        getContentPane().add(periodNumberText, gridBagConstraints);

        periodTypeLabel.setText(resourceMap.getString("periodTypeLabel.text")); // NOI18N
        periodTypeLabel.setName("periodTypeLabel"); // NOI18N
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 3;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
        gridBagConstraints.weighty = 0.25;
        gridBagConstraints.insets = new java.awt.Insets(5, 8, 5, 4);
        getContentPane().add(periodTypeLabel, gridBagConstraints);

        periodTypeCombo.setName("periodTypeCombo"); // NOI18N

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${workingPattern.patternType}"), periodTypeCombo, org.jdesktop.beansbinding.BeanProperty.create("selectedItem"));
        bindingGroup.addBinding(binding);

        periodTypeCombo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                periodTypeChanged(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 4;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.gridwidth = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.weightx = 0.5;
        gridBagConstraints.insets = new java.awt.Insets(5, 4, 5, 8);
        getContentPane().add(periodTypeCombo, gridBagConstraints);

        startDateLabel.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
        startDateLabel.setText(resourceMap.getString("startDateLabel.text")); // NOI18N
        startDateLabel.setName("startDateLabel"); // NOI18N
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
        gridBagConstraints.weighty = 0.25;
        gridBagConstraints.insets = new java.awt.Insets(5, 8, 5, 4);
        getContentPane().add(startDateLabel, gridBagConstraints);

        patternStartDate.setMinimumSize(new java.awt.Dimension(27, 22));
        patternStartDate.setName("patternStartDate"); // NOI18N
        patternStartDate.setPreferredSize(new java.awt.Dimension(95, 22));

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${workingPattern.patternStartDate}"), patternStartDate, org.jdesktop.beansbinding.BeanProperty.create("date"));
        bindingGroup.addBinding(binding);
        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, enablePeriodStart, org.jdesktop.beansbinding.ELProperty.create("${selected}"), patternStartDate, org.jdesktop.beansbinding.BeanProperty.create("enabled"));
        bindingGroup.addBinding(binding);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 2;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
        gridBagConstraints.weighty = 0.25;
        gridBagConstraints.insets = new java.awt.Insets(5, 4, 5, 4);
        getContentPane().add(patternStartDate, gridBagConstraints);

        endDateLabel.setText(resourceMap.getString("endDateLabel.text")); // NOI18N
        endDateLabel.setName("endDateLabel"); // NOI18N
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 3;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
        gridBagConstraints.insets = new java.awt.Insets(5, 8, 5, 4);
        getContentPane().add(endDateLabel, gridBagConstraints);

        periodEndDate.setMinimumSize(new java.awt.Dimension(27, 22));
        periodEndDate.setName("periodEndDate"); // NOI18N
        periodEndDate.setPreferredSize(new java.awt.Dimension(95, 22));

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${workingPattern.patternEndDate}"), periodEndDate, org.jdesktop.beansbinding.BeanProperty.create("date"));
        bindingGroup.addBinding(binding);
        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, enablePeriodEnd, org.jdesktop.beansbinding.ELProperty.create("${selected}"), periodEndDate, org.jdesktop.beansbinding.BeanProperty.create("enabled"));
        bindingGroup.addBinding(binding);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 5;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
        gridBagConstraints.weighty = 0.25;
        gridBagConstraints.insets = new java.awt.Insets(5, 4, 5, 8);
        getContentPane().add(periodEndDate, gridBagConstraints);

        patternPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("patternPanel.border.title"))); // NOI18N
        patternPanel.setName("patternPanel"); // NOI18N
        patternPanel.setLayout(new java.awt.CardLayout());

        clockedPanel.setName("clockedPanel"); // NOI18N
        clockedPanel.setLayout(new java.awt.GridBagLayout());

        startTimeLabel.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
        startTimeLabel.setText(resourceMap.getString("startTimeLabel.text")); // NOI18N
        startTimeLabel.setName("startTimeLabel"); // NOI18N
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
        gridBagConstraints.insets = new java.awt.Insets(5, 4, 5, 4);
        clockedPanel.add(startTimeLabel, gridBagConstraints);

        clockedPatternStartTime.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.DateFormatter(java.text.DateFormat.getTimeInstance(java.text.DateFormat.SHORT))));
        clockedPatternStartTime.setText(resourceMap.getString("clockedPatternStartTime.text")); // NOI18N
        clockedPatternStartTime.setName("clockedPatternStartTime"); // NOI18N
        clockedPatternStartTime.setPreferredSize(null);

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${workingPattern.patternStartTime}"), clockedPatternStartTime, org.jdesktop.beansbinding.BeanProperty.create("value"));
        bindingGroup.addBinding(binding);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.weightx = 0.5;
        gridBagConstraints.insets = new java.awt.Insets(5, 4, 5, 4);
        clockedPanel.add(clockedPatternStartTime, gridBagConstraints);

        endTimeLabel.setText(resourceMap.getString("endTimeLabel.text")); // NOI18N
        endTimeLabel.setName("endTimeLabel"); // NOI18N
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
        gridBagConstraints.insets = new java.awt.Insets(5, 4, 5, 4);
        clockedPanel.add(endTimeLabel, gridBagConstraints);

        clockedPatternEndTime.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.DateFormatter(java.text.DateFormat.getTimeInstance(java.text.DateFormat.SHORT))));
        clockedPatternEndTime.setText(resourceMap.getString("clockedPatternEndTime.text")); // NOI18N
        clockedPatternEndTime.setName("clockedPatternEndTime"); // NOI18N
        clockedPatternEndTime.setPreferredSize(null);

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${workingPattern.patternEndTime}"), clockedPatternEndTime, org.jdesktop.beansbinding.BeanProperty.create("value"));
        bindingGroup.addBinding(binding);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.weightx = 0.5;
        gridBagConstraints.insets = new java.awt.Insets(5, 4, 5, 4);
        clockedPanel.add(clockedPatternEndTime, gridBagConstraints);

        clockedDaysPanel.setName("clockedDaysPanel"); // NOI18N

        clockedMondayCheckBox.setText(resourceMap.getString("clockedMondayCheckBox.text")); // NOI18N
        clockedMondayCheckBox.setName("clockedMondayCheckBox"); // NOI18N

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${workingPattern.monday}"), clockedMondayCheckBox, org.jdesktop.beansbinding.BeanProperty.create("selected"));
        bindingGroup.addBinding(binding);

        clockedDaysPanel.add(clockedMondayCheckBox);

        clockedTuesdayCheckBox.setText(resourceMap.getString("clockedTuesdayCheckBox.text")); // NOI18N
        clockedTuesdayCheckBox.setName("clockedTuesdayCheckBox"); // NOI18N

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${workingPattern.tuesday}"), clockedTuesdayCheckBox, org.jdesktop.beansbinding.BeanProperty.create("selected"));
        bindingGroup.addBinding(binding);

        clockedDaysPanel.add(clockedTuesdayCheckBox);

        clockedWednesdayCheckBox.setText(resourceMap.getString("clockedWednesdayCheckBox.text")); // NOI18N
        clockedWednesdayCheckBox.setName("clockedWednesdayCheckBox"); // NOI18N

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${workingPattern.wednesday}"), clockedWednesdayCheckBox, org.jdesktop.beansbinding.BeanProperty.create("selected"));
        bindingGroup.addBinding(binding);

        clockedDaysPanel.add(clockedWednesdayCheckBox);

        clockedThursdayCheckBox.setText(resourceMap.getString("clockedThursdayCheckBox.text")); // NOI18N
        clockedThursdayCheckBox.setName("clockedThursdayCheckBox"); // NOI18N

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${workingPattern.thursday}"), clockedThursdayCheckBox, org.jdesktop.beansbinding.BeanProperty.create("selected"));
        bindingGroup.addBinding(binding);

        clockedDaysPanel.add(clockedThursdayCheckBox);

        clockedFridayCheckBox.setText(resourceMap.getString("clockedFridayCheckBox.text")); // NOI18N
        clockedFridayCheckBox.setName("clockedFridayCheckBox"); // NOI18N

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${workingPattern.friday}"), clockedFridayCheckBox, org.jdesktop.beansbinding.BeanProperty.create("selected"));
        bindingGroup.addBinding(binding);

        clockedDaysPanel.add(clockedFridayCheckBox);

        clockedSaturdayCheckBox.setText(resourceMap.getString("clockedSaturdayCheckBox.text")); // NOI18N
        clockedSaturdayCheckBox.setName("clockedSaturdayCheckBox"); // NOI18N

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${workingPattern.saturday}"), clockedSaturdayCheckBox, org.jdesktop.beansbinding.BeanProperty.create("selected"));
        bindingGroup.addBinding(binding);

        clockedDaysPanel.add(clockedSaturdayCheckBox);

        clockedSundayCheckBox.setText(resourceMap.getString("clockedSundayCheckBox.text")); // NOI18N
        clockedSundayCheckBox.setName("clockedSundayCheckBox"); // NOI18N

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${workingPattern.sunday}"), clockedSundayCheckBox, org.jdesktop.beansbinding.BeanProperty.create("selected"));
        bindingGroup.addBinding(binding);

        clockedDaysPanel.add(clockedSundayCheckBox);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.gridwidth = 4;
        clockedPanel.add(clockedDaysPanel, gridBagConstraints);

        clockedWeeklyHoursLabel.setText(resourceMap.getString("clockedWeeklyHoursLabel.text")); // NOI18N
        clockedWeeklyHoursLabel.setName("clockedWeeklyHoursLabel"); // NOI18N
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 2;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
        gridBagConstraints.insets = new java.awt.Insets(5, 4, 5, 4);
        clockedPanel.add(clockedWeeklyHoursLabel, gridBagConstraints);

        dailyHoursLabel.setText(resourceMap.getString("dailyHoursLabel.text")); // NOI18N
        dailyHoursLabel.setName("dailyHoursLabel"); // NOI18N
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
        gridBagConstraints.insets = new java.awt.Insets(5, 4, 5, 4);
        clockedPanel.add(dailyHoursLabel, gridBagConstraints);

        clockedDailyHours.setEditable(false);
        clockedDailyHours.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.NumberFormatter(new java.text.DecimalFormat("0.00"))));
        clockedDailyHours.setName("clockedDailyHours"); // NOI18N

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${workingPattern.dailyHours}"), clockedDailyHours, org.jdesktop.beansbinding.BeanProperty.create("value"));
        bindingGroup.addBinding(binding);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.insets = new java.awt.Insets(5, 4, 5, 4);
        clockedPanel.add(clockedDailyHours, gridBagConstraints);

        clockedWeeklyHours.setEditable(false);
        clockedWeeklyHours.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.NumberFormatter(new java.text.DecimalFormat("0.00"))));
        clockedWeeklyHours.setName("clockedWeeklyHours"); // NOI18N

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${workingPattern.weeklyHours}"), clockedWeeklyHours, org.jdesktop.beansbinding.BeanProperty.create("value"));
        bindingGroup.addBinding(binding);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 3;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.insets = new java.awt.Insets(5, 4, 5, 4);
        clockedPanel.add(clockedWeeklyHours, gridBagConstraints);

        patternPanel.add(clockedPanel, "Clocked Panel");

        weeklyFlexiPanel.setName("weeklyFlexiPanel"); // NOI18N
        weeklyFlexiPanel.setLayout(new java.awt.GridBagLayout());

        weeklyFlexiWeeklyLabel.setText(resourceMap.getString("weeklyFlexiWeeklyLabel.text")); // NOI18N
        weeklyFlexiWeeklyLabel.setName("weeklyFlexiWeeklyLabel"); // NOI18N
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
        gridBagConstraints.insets = new java.awt.Insets(5, 4, 5, 4);
        weeklyFlexiPanel.add(weeklyFlexiWeeklyLabel, gridBagConstraints);

        weeklyFlexiWeeklyHours.setMinimumSize(new java.awt.Dimension(100, 20));
        weeklyFlexiWeeklyHours.setName("weeklyFlexiWeeklyHours"); // NOI18N
        weeklyFlexiWeeklyHours.setPreferredSize(new java.awt.Dimension(100, 20));

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${patternHours}"), weeklyFlexiWeeklyHours, org.jdesktop.beansbinding.BeanProperty.create("value"));
        bindingGroup.addBinding(binding);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridwidth = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(5, 4, 5, 4);
        weeklyFlexiPanel.add(weeklyFlexiWeeklyHours, gridBagConstraints);

        weeklyFlexiDaysPanel.setName("weeklyFlexiDaysPanel"); // NOI18N

        weeklyFlexiMondayCheckBox.setText(resourceMap.getString("weeklyFlexiMondayCheckBox.text")); // NOI18N
        weeklyFlexiMondayCheckBox.setName("weeklyFlexiMondayCheckBox"); // NOI18N

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${workingPattern.monday}"), weeklyFlexiMondayCheckBox, org.jdesktop.beansbinding.BeanProperty.create("selected"));
        bindingGroup.addBinding(binding);

        weeklyFlexiDaysPanel.add(weeklyFlexiMondayCheckBox);

        weeklyFlexiTuesdayCheckBox.setText(resourceMap.getString("weeklyFlexiTuesdayCheckBox.text")); // NOI18N
        weeklyFlexiTuesdayCheckBox.setName("weeklyFlexiTuesdayCheckBox"); // NOI18N

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${workingPattern.tuesday}"), weeklyFlexiTuesdayCheckBox, org.jdesktop.beansbinding.BeanProperty.create("selected"));
        bindingGroup.addBinding(binding);

        weeklyFlexiDaysPanel.add(weeklyFlexiTuesdayCheckBox);

        weeklyFlexiWednesdayCheckBox.setText(resourceMap.getString("weeklyFlexiWednesdayCheckBox.text")); // NOI18N
        weeklyFlexiWednesdayCheckBox.setName("weeklyFlexiWednesdayCheckBox"); // NOI18N

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${workingPattern.wednesday}"), weeklyFlexiWednesdayCheckBox, org.jdesktop.beansbinding.BeanProperty.create("selected"));
        bindingGroup.addBinding(binding);

        weeklyFlexiDaysPanel.add(weeklyFlexiWednesdayCheckBox);

        weeklyFlexiThursdayCheckBox.setText(resourceMap.getString("weeklyFlexiThursdayCheckBox.text")); // NOI18N
        weeklyFlexiThursdayCheckBox.setName("weeklyFlexiThursdayCheckBox"); // NOI18N

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${workingPattern.thursday}"), weeklyFlexiThursdayCheckBox, org.jdesktop.beansbinding.BeanProperty.create("selected"));
        bindingGroup.addBinding(binding);

        weeklyFlexiDaysPanel.add(weeklyFlexiThursdayCheckBox);

        weeklyFlexiFridayCheckBox.setText(resourceMap.getString("weeklyFlexiFridayCheckBox.text")); // NOI18N
        weeklyFlexiFridayCheckBox.setName("weeklyFlexiFridayCheckBox"); // NOI18N

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${workingPattern.friday}"), weeklyFlexiFridayCheckBox, org.jdesktop.beansbinding.BeanProperty.create("selected"));
        bindingGroup.addBinding(binding);

        weeklyFlexiDaysPanel.add(weeklyFlexiFridayCheckBox);

        weeklyFlexiSaturdayCheckBox.setText(resourceMap.getString("weeklyFlexiSaturdayCheckBox.text")); // NOI18N
        weeklyFlexiSaturdayCheckBox.setName("weeklyFlexiSaturdayCheckBox"); // NOI18N

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${workingPattern.saturday}"), weeklyFlexiSaturdayCheckBox, org.jdesktop.beansbinding.BeanProperty.create("selected"));
        bindingGroup.addBinding(binding);

        weeklyFlexiDaysPanel.add(weeklyFlexiSaturdayCheckBox);

        weeklyFlexiSundayCheckBox.setText(resourceMap.getString("weeklyFlexiSundayCheckBox.text")); // NOI18N
        weeklyFlexiSundayCheckBox.setName("weeklyFlexiSundayCheckBox"); // NOI18N

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${workingPattern.sunday}"), weeklyFlexiSundayCheckBox, org.jdesktop.beansbinding.BeanProperty.create("selected"));
        bindingGroup.addBinding(binding);

        weeklyFlexiDaysPanel.add(weeklyFlexiSundayCheckBox);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.gridwidth = 3;
        weeklyFlexiPanel.add(weeklyFlexiDaysPanel, gridBagConstraints);

        weeklyFlexiDailyHoursLabel.setText(resourceMap.getString("weeklyFlexiDailyHoursLabel.text")); // NOI18N
        weeklyFlexiDailyHoursLabel.setName("weeklyFlexiDailyHoursLabel"); // NOI18N
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
        gridBagConstraints.insets = new java.awt.Insets(5, 4, 5, 4);
        weeklyFlexiPanel.add(weeklyFlexiDailyHoursLabel, gridBagConstraints);

        weeklyFlexiDailyHours.setEditable(false);
        weeklyFlexiDailyHours.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.NumberFormatter(new java.text.DecimalFormat("0.00"))));
        weeklyFlexiDailyHours.setName("weeklyFlexiDailyHours"); // NOI18N

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${workingPattern.dailyHours}"), weeklyFlexiDailyHours, org.jdesktop.beansbinding.BeanProperty.create("value"));
        bindingGroup.addBinding(binding);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(5, 4, 5, 4);
        weeklyFlexiPanel.add(weeklyFlexiDailyHours, gridBagConstraints);

        patternPanel.add(weeklyFlexiPanel, "Weekly Flexi Panel");

        fixedDailyPanel.setName("fixedDailyPanel"); // NOI18N
        fixedDailyPanel.setLayout(new java.awt.GridBagLayout());

        fixedDailyHoursLabel.setText(resourceMap.getString("fixedDailyHoursLabel.text")); // NOI18N
        fixedDailyHoursLabel.setName("fixedDailyHoursLabel"); // NOI18N
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
        gridBagConstraints.insets = new java.awt.Insets(5, 4, 5, 4);
        fixedDailyPanel.add(fixedDailyHoursLabel, gridBagConstraints);

        fixedDailyDailyHours.setMinimumSize(new java.awt.Dimension(100, 20));
        fixedDailyDailyHours.setName("fixedDailyDailyHours"); // NOI18N
        fixedDailyDailyHours.setPreferredSize(new java.awt.Dimension(100, 20));

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${patternHours}"), fixedDailyDailyHours, org.jdesktop.beansbinding.BeanProperty.create("value"));
        bindingGroup.addBinding(binding);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridwidth = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(5, 4, 5, 4);
        fixedDailyPanel.add(fixedDailyDailyHours, gridBagConstraints);

        fixedDailyDaysPanel.setName("fixedDailyDaysPanel"); // NOI18N

        fixedDailyMondayCheckBox.setText(resourceMap.getString("fixedDailyMondayCheckBox.text")); // NOI18N
        fixedDailyMondayCheckBox.setName("fixedDailyMondayCheckBox"); // NOI18N

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${workingPattern.monday}"), fixedDailyMondayCheckBox, org.jdesktop.beansbinding.BeanProperty.create("selected"));
        bindingGroup.addBinding(binding);

        fixedDailyDaysPanel.add(fixedDailyMondayCheckBox);

        fixedDailyTuesdayCheckBox.setText(resourceMap.getString("fixedDailyTuesdayCheckBox.text")); // NOI18N
        fixedDailyTuesdayCheckBox.setName("fixedDailyTuesdayCheckBox"); // NOI18N

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${workingPattern.tuesday}"), fixedDailyTuesdayCheckBox, org.jdesktop.beansbinding.BeanProperty.create("selected"));
        bindingGroup.addBinding(binding);

        fixedDailyDaysPanel.add(fixedDailyTuesdayCheckBox);

        fixedDailyWednesdayCheckBox.setText(resourceMap.getString("fixedDailyWednesdayCheckBox.text")); // NOI18N
        fixedDailyWednesdayCheckBox.setName("fixedDailyWednesdayCheckBox"); // NOI18N

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${workingPattern.wednesday}"), fixedDailyWednesdayCheckBox, org.jdesktop.beansbinding.BeanProperty.create("selected"));
        bindingGroup.addBinding(binding);

        fixedDailyDaysPanel.add(fixedDailyWednesdayCheckBox);

        fixedDailyThursdayCheckBox.setText(resourceMap.getString("fixedDailyThursdayCheckBox.text")); // NOI18N
        fixedDailyThursdayCheckBox.setName("fixedDailyThursdayCheckBox"); // NOI18N

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${workingPattern.thursday}"), fixedDailyThursdayCheckBox, org.jdesktop.beansbinding.BeanProperty.create("selected"));
        bindingGroup.addBinding(binding);

        fixedDailyDaysPanel.add(fixedDailyThursdayCheckBox);

        fixedDailyFridayCheckBox.setText(resourceMap.getString("fixedDailyFridayCheckBox.text")); // NOI18N
        fixedDailyFridayCheckBox.setName("fixedDailyFridayCheckBox"); // NOI18N

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${workingPattern.friday}"), fixedDailyFridayCheckBox, org.jdesktop.beansbinding.BeanProperty.create("selected"));
        bindingGroup.addBinding(binding);

        fixedDailyDaysPanel.add(fixedDailyFridayCheckBox);

        fixedDailySaturdayCheckBox.setText(resourceMap.getString("fixedDailySaturdayCheckBox.text")); // NOI18N
        fixedDailySaturdayCheckBox.setName("fixedDailySaturdayCheckBox"); // NOI18N

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${workingPattern.saturday}"), fixedDailySaturdayCheckBox, org.jdesktop.beansbinding.BeanProperty.create("selected"));
        bindingGroup.addBinding(binding);

        fixedDailyDaysPanel.add(fixedDailySaturdayCheckBox);

        fixedDailySundayCheckBox.setText(resourceMap.getString("fixedDailySundayCheckBox.text")); // NOI18N
        fixedDailySundayCheckBox.setName("fixedDailySundayCheckBox"); // NOI18N

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${workingPattern.sunday}"), fixedDailySundayCheckBox, org.jdesktop.beansbinding.BeanProperty.create("selected"));
        bindingGroup.addBinding(binding);

        fixedDailyDaysPanel.add(fixedDailySundayCheckBox);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.gridwidth = 3;
        fixedDailyPanel.add(fixedDailyDaysPanel, gridBagConstraints);

        fixedDailyWeeklyHoursLabel.setText(resourceMap.getString("fixedDailyWeeklyHoursLabel.text")); // NOI18N
        fixedDailyWeeklyHoursLabel.setName("fixedDailyWeeklyHoursLabel"); // NOI18N
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
        gridBagConstraints.insets = new java.awt.Insets(5, 4, 5, 4);
        fixedDailyPanel.add(fixedDailyWeeklyHoursLabel, gridBagConstraints);

        fixedDailyWeeklyHours.setEditable(false);
        fixedDailyWeeklyHours.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.NumberFormatter(new java.text.DecimalFormat("0.00"))));
        fixedDailyWeeklyHours.setName("fixedDailyWeeklyHours"); // NOI18N

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${workingPattern.weeklyHours}"), fixedDailyWeeklyHours, org.jdesktop.beansbinding.BeanProperty.create("value"));
        bindingGroup.addBinding(binding);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(5, 4, 5, 4);
        fixedDailyPanel.add(fixedDailyWeeklyHours, gridBagConstraints);

        patternPanel.add(fixedDailyPanel, "Fixed Daily Panel");

        fullFlexiPanel.setName("fullFlexiPanel"); // NOI18N
        fullFlexiPanel.setLayout(new java.awt.GridBagLayout());

        fullFlexiDailyHoursLabel.setText(resourceMap.getString("fullFlexiDailyHoursLabel.text")); // NOI18N
        fullFlexiDailyHoursLabel.setName("fullFlexiDailyHoursLabel"); // NOI18N
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
        gridBagConstraints.insets = new java.awt.Insets(5, 4, 5, 4);
        fullFlexiPanel.add(fullFlexiDailyHoursLabel, gridBagConstraints);

        fullFlexiDailyHours.setMinimumSize(new java.awt.Dimension(100, 20));
        fullFlexiDailyHours.setName("fullFlexiDailyHours"); // NOI18N
        fullFlexiDailyHours.setPreferredSize(new java.awt.Dimension(100, 20));

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${patternHours}"), fullFlexiDailyHours, org.jdesktop.beansbinding.BeanProperty.create("value"));
        bindingGroup.addBinding(binding);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(5, 4, 5, 4);
        fullFlexiPanel.add(fullFlexiDailyHours, gridBagConstraints);

        fullFlexiWeeklyLabel.setText(resourceMap.getString("fullFlexiWeeklyLabel.text")); // NOI18N
        fullFlexiWeeklyLabel.setName("fullFlexiWeeklyLabel"); // NOI18N
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
        gridBagConstraints.insets = new java.awt.Insets(5, 4, 5, 4);
        fullFlexiPanel.add(fullFlexiWeeklyLabel, gridBagConstraints);

        fullFlexiWeeklyHours.setEditable(false);
        fullFlexiWeeklyHours.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.NumberFormatter(new java.text.DecimalFormat("0.00"))));
        fullFlexiWeeklyHours.setName("fullFlexiWeeklyHours"); // NOI18N

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${workingPattern.dailyHours}"), fullFlexiWeeklyHours, org.jdesktop.beansbinding.BeanProperty.create("value"));
        bindingGroup.addBinding(binding);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.insets = new java.awt.Insets(5, 4, 5, 4);
        fullFlexiPanel.add(fullFlexiWeeklyHours, gridBagConstraints);

        patternPanel.add(fullFlexiPanel, "Full Flexi Panel");

        sessionalPanel.setName("sessionalPanel"); // NOI18N
        sessionalPanel.setLayout(new java.awt.GridBagLayout());

        sessionalHoursLabel.setText(resourceMap.getString("sessionalHoursLabel.text")); // NOI18N
        sessionalHoursLabel.setName("sessionalHoursLabel"); // NOI18N
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
        gridBagConstraints.insets = new java.awt.Insets(5, 4, 5, 4);
        sessionalPanel.add(sessionalHoursLabel, gridBagConstraints);

        sessionalDailyHours.setMinimumSize(new java.awt.Dimension(100, 20));
        sessionalDailyHours.setName("sessionalDailyHours"); // NOI18N
        sessionalDailyHours.setPreferredSize(new java.awt.Dimension(100, 20));

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${patternHours}"), sessionalDailyHours, org.jdesktop.beansbinding.BeanProperty.create("value"));
        bindingGroup.addBinding(binding);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridwidth = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(5, 4, 5, 4);
        sessionalPanel.add(sessionalDailyHours, gridBagConstraints);

        sessionalDaysPanel.setName("sessionalDaysPanel"); // NOI18N

        sessionalMondayCheckBox.setText(resourceMap.getString("sessionalMondayCheckBox.text")); // NOI18N
        sessionalMondayCheckBox.setName("sessionalMondayCheckBox"); // NOI18N

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${workingPattern.monday}"), sessionalMondayCheckBox, org.jdesktop.beansbinding.BeanProperty.create("selected"));
        bindingGroup.addBinding(binding);

        sessionalDaysPanel.add(sessionalMondayCheckBox);

        sessionalTuesdayCheckBox.setText(resourceMap.getString("sessionalTuesdayCheckBox.text")); // NOI18N
        sessionalTuesdayCheckBox.setName("sessionalTuesdayCheckBox"); // NOI18N

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${workingPattern.tuesday}"), sessionalTuesdayCheckBox, org.jdesktop.beansbinding.BeanProperty.create("selected"));
        bindingGroup.addBinding(binding);

        sessionalDaysPanel.add(sessionalTuesdayCheckBox);

        sessionalWednesdayCheckBox.setText(resourceMap.getString("sessionalWednesdayCheckBox.text")); // NOI18N
        sessionalWednesdayCheckBox.setName("sessionalWednesdayCheckBox"); // NOI18N

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${workingPattern.wednesday}"), sessionalWednesdayCheckBox, org.jdesktop.beansbinding.BeanProperty.create("selected"));
        bindingGroup.addBinding(binding);

        sessionalDaysPanel.add(sessionalWednesdayCheckBox);

        sessionalThursdayCheckBox.setText(resourceMap.getString("sessionalThursdayCheckBox.text")); // NOI18N
        sessionalThursdayCheckBox.setName("sessionalThursdayCheckBox"); // NOI18N

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${workingPattern.thursday}"), sessionalThursdayCheckBox, org.jdesktop.beansbinding.BeanProperty.create("selected"));
        bindingGroup.addBinding(binding);

        sessionalDaysPanel.add(sessionalThursdayCheckBox);

        sessionalFridayCheckBox.setText(resourceMap.getString("sessionalFridayCheckBox.text")); // NOI18N
        sessionalFridayCheckBox.setName("sessionalFridayCheckBox"); // NOI18N

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${workingPattern.friday}"), sessionalFridayCheckBox, org.jdesktop.beansbinding.BeanProperty.create("selected"));
        bindingGroup.addBinding(binding);

        sessionalDaysPanel.add(sessionalFridayCheckBox);

        sessionalSaturdayCheckBox.setText(resourceMap.getString("sessionalSaturdayCheckBox.text")); // NOI18N
        sessionalSaturdayCheckBox.setName("sessionalSaturdayCheckBox"); // NOI18N

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${workingPattern.saturday}"), sessionalSaturdayCheckBox, org.jdesktop.beansbinding.BeanProperty.create("selected"));
        bindingGroup.addBinding(binding);

        sessionalDaysPanel.add(sessionalSaturdayCheckBox);

        sessionalSundayCheckBox.setText(resourceMap.getString("sessionalSundayCheckBox.text")); // NOI18N
        sessionalSundayCheckBox.setName("sessionalSundayCheckBox"); // NOI18N

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${workingPattern.sunday}"), sessionalSundayCheckBox, org.jdesktop.beansbinding.BeanProperty.create("selected"));
        bindingGroup.addBinding(binding);

        sessionalDaysPanel.add(sessionalSundayCheckBox);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.gridwidth = 3;
        sessionalPanel.add(sessionalDaysPanel, gridBagConstraints);

        sessionalWeeklyHoursLabel.setText(resourceMap.getString("sessionalWeeklyHoursLabel.text")); // NOI18N
        sessionalWeeklyHoursLabel.setName("sessionalWeeklyHoursLabel"); // NOI18N
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
        gridBagConstraints.insets = new java.awt.Insets(5, 4, 5, 4);
        sessionalPanel.add(sessionalWeeklyHoursLabel, gridBagConstraints);

        sessionalWeeklyHours.setEditable(false);
        sessionalWeeklyHours.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.NumberFormatter(new java.text.DecimalFormat("0.00"))));
        sessionalWeeklyHours.setName("sessionalWeeklyHours"); // NOI18N

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${workingPattern.weeklyHours}"), sessionalWeeklyHours, org.jdesktop.beansbinding.BeanProperty.create("value"));
        bindingGroup.addBinding(binding);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(5, 4, 5, 4);
        sessionalPanel.add(sessionalWeeklyHours, gridBagConstraints);

        patternPanel.add(sessionalPanel, "Sessional Panel");

        adHociPanel.setName("adHociPanel"); // NOI18N
        adHociPanel.setLayout(new java.awt.GridBagLayout());

        jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N
        jLabel1.setName("jLabel1"); // NOI18N
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        adHociPanel.add(jLabel1, gridBagConstraints);

        patternPanel.add(adHociPanel, "Ad Hoc Panel");

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 3;
        gridBagConstraints.gridwidth = 6;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(5, 4, 5, 4);
        getContentPane().add(patternPanel, gridBagConstraints);

        buttonPanel.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 0, 5, 0));
        buttonPanel.setName("buttonPanel"); // NOI18N

        javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(TimeRecording.TimeRecordingApp.class).getContext().getActionMap(WorkingPatternEditor.class, this);
        saveButton.setAction(actionMap.get("SaveButton")); // NOI18N
        saveButton.setName("saveButton"); // NOI18N
        buttonPanel.add(saveButton);

        cancelButton.setAction(actionMap.get("CancelButton")); // NOI18N
        cancelButton.setName("cancelButton"); // NOI18N
        buttonPanel.add(cancelButton);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 4;
        gridBagConstraints.gridwidth = 6;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.weightx = 1.0;
        getContentPane().add(buttonPanel, gridBagConstraints);

        enablePeriodStart.setText(resourceMap.getString("enablePeriodStart.text")); // NOI18N
        enablePeriodStart.setHorizontalTextPosition(javax.swing.SwingConstants.LEADING);
        enablePeriodStart.setName("enablePeriodStart"); // NOI18N
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
        getContentPane().add(enablePeriodStart, gridBagConstraints);

        enablePeriodEnd.setText(resourceMap.getString("enablePeriodEnd.text")); // NOI18N
        enablePeriodEnd.setHorizontalTextPosition(javax.swing.SwingConstants.LEADING);
        enablePeriodEnd.setName("enablePeriodEnd"); // NOI18N
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 4;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
        getContentPane().add(enablePeriodEnd, gridBagConstraints);

        bindingGroup.bind();

        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        setBounds((screenSize.width-647)/2, (screenSize.height-329)/2, 647, 329);
    }// </editor-fold>//GEN-END:initComponents

    private void periodTypeChanged(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_periodTypeChanged

        CardLayout layout = (CardLayout)patternPanel.getLayout();

        switch (workingPattern.getPatternType()) {
            case CLOCKING_TIME:
                layout.show(patternPanel, CLOCKED_PANEL);
                break;
            case DAILY_PAID_TIME:
                layout.show(patternPanel, DAILY_PANEL);
                break;
            case WEEKLY_PAID_TIME:
                layout.show(patternPanel, WEEKLY_FLEXI_PANEL);
                break;
            case FLEXI_PAID_TIME:
                layout.show(patternPanel, FULL_FLEXI_PANEL);
                break;
            case SESSIONAL_TIME:
                layout.show(patternPanel, SESSIONAL_PANEL);
                break;
            case AD_HOC_TIME:
                layout.show(patternPanel, AD_HOC_PANEL);
                break;
            default:
                break;
        }
    }//GEN-LAST:event_periodTypeChanged

    @Action
    public void CancelButton() {
        setSaved(false);
        setVisible(false);
    }

    @Action
    public void SaveButton() {

        if (!enablePeriodStart.isSelected()) {
            workingPattern.setPatternStartDate(DaisyChainSystem.AGES_AGO);
        }

        if (!enablePeriodEnd.isSelected()) {
            workingPattern.setPatternEndDate(DaisyChainSystem.IN_THE_FUTURE);
        }

        workingPattern.setNoOfHours(floatConverter.round(
                workingPattern.getNoOfHours()));
        
        setSaved(true);
        setVisible(false);
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel adHociPanel;
    private javax.swing.JPanel buttonPanel;
    private javax.swing.JButton cancelButton;
    private javax.swing.JFormattedTextField clockedDailyHours;
    private javax.swing.JPanel clockedDaysPanel;
    private javax.swing.JCheckBox clockedFridayCheckBox;
    private javax.swing.JCheckBox clockedMondayCheckBox;
    private javax.swing.JPanel clockedPanel;
    private javax.swing.JFormattedTextField clockedPatternEndTime;
    private javax.swing.JFormattedTextField clockedPatternStartTime;
    private javax.swing.JCheckBox clockedSaturdayCheckBox;
    private javax.swing.JCheckBox clockedSundayCheckBox;
    private javax.swing.JCheckBox clockedThursdayCheckBox;
    private javax.swing.JCheckBox clockedTuesdayCheckBox;
    private javax.swing.JCheckBox clockedWednesdayCheckBox;
    private javax.swing.JFormattedTextField clockedWeeklyHours;
    private javax.swing.JLabel clockedWeeklyHoursLabel;
    private javax.swing.JLabel dailyHoursLabel;
    private javax.swing.JLabel employeeLabel;
    private javax.swing.JPanel employeePanel;
    private javax.swing.JTextField employeeText;
    private javax.swing.JCheckBox enablePeriodEnd;
    private javax.swing.JCheckBox enablePeriodStart;
    private javax.swing.JLabel endDateLabel;
    private javax.swing.JLabel endTimeLabel;
    private javax.swing.JFormattedTextField fixedDailyDailyHours;
    private javax.swing.JPanel fixedDailyDaysPanel;
    private javax.swing.JCheckBox fixedDailyFridayCheckBox;
    private javax.swing.JLabel fixedDailyHoursLabel;
    private javax.swing.JCheckBox fixedDailyMondayCheckBox;
    private javax.swing.JPanel fixedDailyPanel;
    private javax.swing.JCheckBox fixedDailySaturdayCheckBox;
    private javax.swing.JCheckBox fixedDailySundayCheckBox;
    private javax.swing.JCheckBox fixedDailyThursdayCheckBox;
    private javax.swing.JCheckBox fixedDailyTuesdayCheckBox;
    private javax.swing.JCheckBox fixedDailyWednesdayCheckBox;
    private javax.swing.JFormattedTextField fixedDailyWeeklyHours;
    private javax.swing.JLabel fixedDailyWeeklyHoursLabel;
    private javax.swing.JFormattedTextField fullFlexiDailyHours;
    private javax.swing.JLabel fullFlexiDailyHoursLabel;
    private javax.swing.JPanel fullFlexiPanel;
    private javax.swing.JFormattedTextField fullFlexiWeeklyHours;
    private javax.swing.JLabel fullFlexiWeeklyLabel;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JPanel patternPanel;
    private com.toedter.calendar.JDateChooser patternStartDate;
    private com.toedter.calendar.JDateChooser periodEndDate;
    private javax.swing.JLabel periodNumberLabel;
    private javax.swing.JTextField periodNumberText;
    private TimeRecording.widgets.PeriodTypeComboBox periodTypeCombo;
    private TimeRecording.enums.PatternTypeConverter periodTypeConverter;
    private javax.swing.JLabel periodTypeLabel;
    private TimeRecording.forms.renderers.PeriodTypeListCellRenderer periodTypeListCellRenderer;
    private javax.swing.JButton saveButton;
    private javax.swing.JFormattedTextField sessionalDailyHours;
    private javax.swing.JPanel sessionalDaysPanel;
    private javax.swing.JCheckBox sessionalFridayCheckBox;
    private javax.swing.JLabel sessionalHoursLabel;
    private javax.swing.JCheckBox sessionalMondayCheckBox;
    private javax.swing.JPanel sessionalPanel;
    private javax.swing.JCheckBox sessionalSaturdayCheckBox;
    private javax.swing.JCheckBox sessionalSundayCheckBox;
    private javax.swing.JCheckBox sessionalThursdayCheckBox;
    private javax.swing.JCheckBox sessionalTuesdayCheckBox;
    private javax.swing.JCheckBox sessionalWednesdayCheckBox;
    private javax.swing.JFormattedTextField sessionalWeeklyHours;
    private javax.swing.JLabel sessionalWeeklyHoursLabel;
    private javax.swing.JLabel startDateLabel;
    private javax.swing.JLabel startTimeLabel;
    private javax.swing.JFormattedTextField weeklyFlexiDailyHours;
    private javax.swing.JLabel weeklyFlexiDailyHoursLabel;
    private javax.swing.JPanel weeklyFlexiDaysPanel;
    private javax.swing.JCheckBox weeklyFlexiFridayCheckBox;
    private javax.swing.JCheckBox weeklyFlexiMondayCheckBox;
    private javax.swing.JPanel weeklyFlexiPanel;
    private javax.swing.JCheckBox weeklyFlexiSaturdayCheckBox;
    private javax.swing.JCheckBox weeklyFlexiSundayCheckBox;
    private javax.swing.JCheckBox weeklyFlexiThursdayCheckBox;
    private javax.swing.JCheckBox weeklyFlexiTuesdayCheckBox;
    private javax.swing.JCheckBox weeklyFlexiWednesdayCheckBox;
    private javax.swing.JFormattedTextField weeklyFlexiWeeklyHours;
    private javax.swing.JLabel weeklyFlexiWeeklyLabel;
    private org.jdesktop.beansbinding.BindingGroup bindingGroup;
    // End of variables declaration//GEN-END:variables
}